<html>
<head><meta charset="utf-8"><title>infinite loop in windows::fill_utf16_buf? · t-libs · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/index.html">t-libs</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/infinite.20loop.20in.20windows.3A.3Afill_utf16_buf.3F.html">infinite loop in windows::fill_utf16_buf?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="200404049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/infinite%20loop%20in%20windows%3A%3Afill_utf16_buf%3F/near/200404049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Roland Kuhn <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/infinite.20loop.20in.20windows.3A.3Afill_utf16_buf.3F.html#200404049">(Jun 10 2020 at 11:26)</a>:</h4>
<p>Looking at <a href="https://github.com/rust-lang/rust/blob/master/src/libstd/sys/windows/mod.rs#L157">the code</a> without prior knowledge of Windows system call semantics, I see an infinite loop if the syscall were to fill up the buffer exactly: when <code>k == n</code> on line 195, the loop will be rerun with no changes, which should result in the exact same outcome if the syscall is idempotent.</p>
<p>Even if Windows guarantees in some way that this cannot happen, would it not be clearer to handle this case in an obvious fashion?</p>



<a name="200408871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/infinite%20loop%20in%20windows%3A%3Afill_utf16_buf%3F/near/200408871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> DPC <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/infinite.20loop.20in.20windows.3A.3Afill_utf16_buf.3F.html#200408871">(Jun 10 2020 at 12:28)</a>:</h4>
<p>i would suggest creating an issue about this as well <span class="user-mention" data-user-id="302838">@Roland Kuhn</span></p>



<a name="200410817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/infinite%20loop%20in%20windows%3A%3Afill_utf16_buf%3F/near/200410817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Roland Kuhn <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/infinite.20loop.20in.20windows.3A.3Afill_utf16_buf.3F.html#200410817">(Jun 10 2020 at 12:47)</a>:</h4>
<p>done: <a href="https://github.com/rust-lang/rust/issues/73212">https://github.com/rust-lang/rust/issues/73212</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>